#ifndef _ConstantFragmentation_H_
#define _ConstantFragmentation_H_

//
// ConstantFragmentation.h
//
// Created by TB on 11/18/11.
// Copyright 2011 BNL. All rights reserved.
//

#include <Rtypes.h>

#include "tppmc/FragmentationFunction.h"
#include "tppmc/Particle.h"

namespace tppmc {
   
   
   /**
    Fragmentation of a parton to a hadron with a constant fraction
    of the parton's momentum.
    */
   class ConstantFragmentation : public FragmentationFunction {
      
   public:
      
      
      /**
       Constructor.
       */
      ConstantFragmentation(double fraction = 1.);
      
      
      /**
       Destructor.
       */
      virtual ~ConstantFragmentation();
      
      
      /**
       Fragment the input parton into a hadron.
       The type of hadron to which to fragment is set via SetSpecies().
       */
      virtual std::vector<tppmc::Hadron> Fragment(const Parton&,
                                                  double Q2 = 0.);
      
      /**
       Evaluate the fragmentation.
       Needs implementing!
       */
      virtual double Evaluate(const pythpart&,
                              const Hadron&,
                              double) {
         return 0.;
      }
      
      virtual std::string Name() const { return "constant momentum fraction"; }
      virtual double ZMin() const { return 0.; }
      virtual double ZMax() const { return 1.; }

      /**
       Returns true if the fragmentation of the input parton type
       is supported by this function.
       */
      virtual bool Supports(const pythpart&) const;
      
      
      /**
       The fraction of the parton's momentum to
       pass to the produced hadron.
       */
      double Fraction() const { return mFraction; }
      
      virtual double MinimumScale() const { return 0.; }
      virtual double MaximumScale() const { return 1.e6; }

   protected:
      
      double mFraction;
      
      ClassDef(tppmc::ConstantFragmentation, 1)
   };
   
   inline bool ConstantFragmentation::Supports(const pythpart&) const {
      return true;
   }
   
   
} // namespace tppmc

#endif
